package com.artron.mediaartron.ui.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Class description here
 *
 * @author doing
 * @version 1.0.0
 * @since 2017-09-14.
 */

public class CustomViewPager extends ViewPager {

    private boolean isUnTouchIt = false;

    public CustomViewPager(Context context) {
        super(context);
    }

    public CustomViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setUnTouchIt(boolean unTouchIt) {
        isUnTouchIt = unTouchIt;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return isUnTouchIt && super.onInterceptTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        return isUnTouchIt && super.onTouchEvent(ev);
    }
}
